from langchain_core.prompts import PromptTemplate
from langchain_openai import  ChatOpenAI
from langchain.chains import LLMChain

#模型
mode = ChatOpenAI(model_name="qwen-plus",
    base_url="https://dashscope.aliyuncs.com/compatible-mode/v1",
    api_key="sk-4f1498f1c0314ba79ea2919bd7a02c4d",
    temperature=0.7
)

#创建提示词模版chat模型
prop_template = PromptTemplate(
    input_variables=["name"],
    template = "你是一个文案高手，专门为{name}设计文案，举例3个卖点"
)

#创建一个Chain
chain = LLMChain(
    llm = mode,
    prompt = prop_template
)
result = chain.invoke("智能手机")
print(result) 